# -*- coding: utf-8 -*-
import os
import time
from script_manager.manager import ScriptManager

def main():
    manager = ScriptManager()
    scriptList = [
        # 需要调用的脚本，以及 脚本运行间隔
        # {"file":"MovingAverage","interval_minutes":5,"title":'均线突破'},
        # {"file":"DonchianChannels","interval_minutes":5,"title":'唐奇安通道逆势策略'},
        # {"file":"junxianFasan","interval_minutes":6,"title":'均线高质量多空策略'},
        # {"file":"Ema10zhen","interval_minutes":7,"title":'EMA10均线回归策略'},
        {"file":"junxianGMMA","interval_minutes":8,"title":'顾比均线方向策略'},
        {"file":"junxianGMMA4H","interval_minutes":8,"title":'顾比均线方向策略4H'},
        # {"file":"junxianOne","interval_minutes":6,"title":'正收益趋势策略'},
        {"file":"downloadK","interval_minutes":5,"title":'数据采集'}, 
    ]
    for item in scriptList:
        example_script = os.path.join(manager.scripts_dir, f"{item['file']}.py")
        print("add file "+ example_script)
        manager.add_script(example_script, item['interval_minutes'],item['title'])  # 每1分钟运行一次
    
    # 启动管理器
    try:
        manager.start()
        # 保持主线程运行
        while True:
            time.sleep(1)
    except (KeyboardInterrupt, SystemExit):
        manager.stop()
        print('脚本停止')
if __name__ == "__main__":
    main()